'''
Created on Mar 1, 2020
Pytorch Implementation of LightGCN in
Xiangnan He et al. LightGCN: Simplifying and Powering Graph Convolution Network for Recommendation

@author: Jianbai Ye (gusye@mail.ustc.edu.cn)
'''

import os
import multiprocessing
from os.path import join

import torch

os.environ['KMP_DUPLICATE_LIB_OK'] = 'True'
# from parse import parse_args
# args = parse_args()

ROOT_PATH = "/data/tshuang/Projects/lightGCN/"
CODE_PATH = join(ROOT_PATH, 'Rec_SAUC')
BOARD_PATH = join(CODE_PATH, 'runs')

CORES = multiprocessing.cpu_count() // 2
# tensorboard = 1
# comment = "lgn"
# let pandas shut up
# from warnings import simplefilter
# simplefilter(action="ignore", category=FutureWarning)
config = {
    # path
    "data_path": join(ROOT_PATH, 'data'),
    "cpp_path": join(CODE_PATH, 'sources'),
    'checkpoints_path': join(CODE_PATH, 'checkpoints'),

    # dataset
    "neg_ratio": 1,     # 负采样比
    "sample_style": "uij",    # uil: user-item-label, uij: user-posItem-NegItem

    # model
    'latent_dim_rec': 64,
    'lightGCN_n_layers': 3,
    'dropout': 0,
    'keep_prob': 0.6,
    'A_split': False,
    'A_n_fold': 100,

    # hash
    "tanh_beta": 1,

    # train
    'pretrain': 0,
    "is_use_early_stop": True,

    # test
    'test_u_batch_size': 100,
    'multicore': 1,

    # other
    'bigdata': False,
    "seed": 2020,
    "LOAD": 0,

    # 重要配置
    "device": torch.device('cuda:2' if torch.cuda.is_available() else "cpu"),
    "dataset": 'gowalla',  # [lastfm, gowalla, yelp2018, amazon-book]
    "sample_way": "user_decare",    # [all_pos_random, user_decare]
    "model": 'lgn_hash',  # [mf, lgn, lgn_hash]
    "loss": 'bpr',  # [bce, bpr, sauc_for_sample, sauc_for_user]
    "tau": 0.02,
    "weight_decay": 0.0001,

    "TRAIN_epochs": 1000,
    'batch_size': 2 ** 18,
    'lr': 0.0001,

    "topks": eval("[5, 10, 20, 50, 100, 200]"),
}
